﻿using System;
using System.Windows.Media.Imaging;

internal class BufferView
{
    private int height;
    private WriteableBitmap img;
    protected internal NES nes;
    private int[] pix;
    private int width;

    internal BufferView(NES nes, int width, int height)
    {
        this.nes = nes;
        this.width = width;
        this.height = height;
    }

    internal virtual void imageReady(bool skipFrame)
    {
        if (!skipFrame)
        {
            for (int i = 0; i < 0xf000; i++)
            {
                this.Image.Pixels[i] = this.Buffer[i];
            }
            this.nes.ppu.requestRenderAll = false;
        }
    }

    internal virtual void init()
    {
        this.img = new WriteableBitmap(0x100, 240);
        int[] numArray = new int[0xf000];
        this.pix = numArray;
        this.nes.ppu.buffer = numArray;
    }



    internal virtual int[] Buffer
    {
        get
        {
            return this.pix;
        }
    }

    internal virtual WriteableBitmap Image
    {
        get
        {
            return this.img;
        }
    }

    internal int[] getBuffer()
    {
        return Buffer;
    }

    internal bool scalingEnabled()
    {
        return false;
    }

    internal bool useHWScaling()
    {
        return false;
    }
}

